﻿<%@ Page Title="Xtablish CRM / Email Templates" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="EmailTemplates.aspx.cs" Inherits="Web.EmailTemplate.EmailTemplates" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="headContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Con1" runat="server">
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function OnClientClose(oWnd, args) { }
            function ClearClick() {
                document.getElementById('<%= txtTemplateName.ClientID %>').value = "";
                document.getElementById('<%= txtDescription.ClientID %>').value = "";
                document.getElementById('<%= txtSubject.ClientID %>').value = "";
            }
        </script>
    </telerik:RadCodeBlock>
    <div class="register">
        <div class="container-fluid">
            <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
                <div class="row">
                    <div class="panel panel-default">
                        <div class="panel-heading" role="tab" id="headingOne">
                            <h4 class="panel-title">
                                <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">Search <i class="glyphicon glyphicon-circle-arrow-down" style="display: none;"></i><i class="glyphicon glyphicon-circle-arrow-up"></i>
                                </a>
                            </h4>
                        </div>
                        <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
                            <div class="panel-body">
                                <div class="firstrow">
                                    <div class="edit-form">
                                        <div class="control-group">
                                            <div class="col-md-4 distance-control">
                                                <div class="col-md-4">
                                                    <label class="control-label">Template Name </label>
                                                </div>
                                                <div class="col-md-8">
                                                    <div class="controls">
                                                        <asp:TextBox ID="txtTemplateName" runat="server" class="form-control" onkeypress="isPressEnter(event)" />
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-md-4 distance-control">
                                                <div class="col-md-4">
                                                    <label class="control-label">Description </label>
                                                </div>
                                                <div class="col-md-8">
                                                    <div class="controls">
                                                        <asp:TextBox ID="txtDescription" runat="server" class="form-control" onkeypress="isPressEnter(event)" />
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-md-4 distance-control">
                                                <div class="col-md-4">
                                                    <label class="control-label">Subject </label>
                                                </div>
                                                <div class="col-md-8">
                                                    <div class="controls">
                                                        <asp:TextBox ID="txtSubject" runat="server" class="form-control" onkeypress="isPressEnter(event)" />
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="clearfix"></div>
                                        </div>
                                    </div>
                                </div>
                                <div class="popup-btn">
                                    <div class="col-md-12 btn-edit">
                                       <button id="btnSearch" type="button" class="btn btn-defaul" runat="server" onserverclick="btnSearch_ServerClick">
                                            <img src="../Images/search.png" style="width: 20px; height: 20px" />
                                            Search
                                        </button>
                                        <button class="btn btn-defaul" type="button" onclick="ClearClick();return false;">
                                            <img src="../Images/clear.png" style="width: 20px; height: 20px" />
                                            Clear
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="edit-form highlight">
                        <div class="control-group">
                            <h4>Email Templates</h4>
                        </div>
                        <div class="col-md-12 combobox-email">
                            <div class="col-md-8 btn-edit">
                                <button id="btnAddEmailTemplate" type="button" class="btn btn-defaul" runat="server" onserverclick="btnAddEmailTemplate_ServerClick">
                                    <img src="../Images/add.png" style="width: 16px; height: 16px" />
                                    Add Email Template
                                </button>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <div style="width: 100%">
                            <telerik:RadGrid ID="RadGrid1" ShowStatusBar="True" runat="server" AllowPaging="True" AllowSorting="True" AllowMultiRowSelection="True"
                                AutoGenerateColumns="False" GridLines="None" Width="100%" OnNeedDataSource="RadGrid1_NeedDataSource"
                                Font-Size="12px" EnableLinqExpressions="false" OnItemCreated="RadGrid1_ItemCreated" OnItemCommand="RadGrid1_ItemCommand">
                                <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="false">
                                    <%--<ClientEvents OnRowClick="OnRowClick" />--%>
                                    <Selecting AllowRowSelect="false" />
                                </ClientSettings>
                                <MasterTableView PageSize="10" NoDetailRecordsText="No records" NoMasterRecordsText="No records" ShowHeader="true" DataKeyNames="ID" TableLayout="Fixed" >
                                    <Columns>                                      
                                        <telerik:GridBoundColumn DataField="TEMPLATE_NAME" HeaderText="Template Name" UniqueName="TEMPLATE_NAME" SortExpression="TEMPLATE_NAME">
                                            <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="25%" />
                                            <ItemStyle Wrap="false" HorizontalAlign="left" Width="25%" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="SUBJECT" HeaderText="Subject" UniqueName="SUBJECT" SortExpression="SUBJECT">
                                            <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="30%" />
                                            <ItemStyle Wrap="false" HorizontalAlign="left" Width="30%" />
                                        </telerik:GridBoundColumn>
                                      <telerik:GridBoundColumn DataField="DESCRIPTION" HeaderText="Description" UniqueName="DESCRIPTION" SortExpression="DESCRIPTION">
                                            <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="37%" />
                                            <ItemStyle Wrap="false" HorizontalAlign="left" Width="37%" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridTemplateColumn HeaderText="Tools" UniqueName="TOOLS">
                                            <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="7%" />
                                            <ItemStyle HorizontalAlign="center" Width="7%" />
                                            <ItemTemplate>
                                                <asp:LinkButton ID="lbtnEdit" runat="server" CommandName="Edit" ToolTip="Edit">
                                                    <image src="../Images/edit.png" style="width: 16px; height: 16px"/>
                                                </asp:LinkButton>
                                                &nbsp
                                                <asp:LinkButton ID="lbtnDelete" runat="server" ToolTip="Delete" CommandName="Delete" OnClientClick="return radConfirmDelete(this, 'Are you sure you want to delete this email template ?');">
                                                    <image src="../Images/delete.png" style="width: 16px; height: 16px"/>
                                                </asp:LinkButton>
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                    </Columns>
                                    <PagerStyle PageSizes="5,10,20,50" PagerTextFormat="{4}<strong>{5}</strong> item(s) matching your search criteria"
                                        PageSizeLabelText="Items per page:" AlwaysVisible="true" />
                                </MasterTableView>
                                <PagerStyle Mode="NumericPages"></PagerStyle>
                            </telerik:RadGrid>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
